using System;
using System.Data;
using Utils;
using Utils.DatabaseUtils;


namespace QLBH
{
public class tblDonViTinhUI
{ 
	private int idDonVi;
	public int IdDonVi
	{
		get { return idDonVi;}
		set { idDonVi = value;}
	}

	private String tenDonVi;
	public String TenDonVi
	{
		get { return tenDonVi;}
		set { tenDonVi = value;}
	}

	private String kyHieu;
	public String KyHieu
	{
		get { return kyHieu;}
		set { kyHieu = value;}
	}

	private bool hoatDong;
	public bool HoatDong
	{
		get { return hoatDong;}
		set { hoatDong = value;}
	}

	public tblDonViTinhUI() {}

	public tblDonViTinhUI(int idDonVi, String tenDonVi, String kyHieu, bool hoatDong)
	 {
		this.idDonVi = idDonVi;
 		this.tenDonVi = tenDonVi;
 		this.kyHieu = kyHieu;
 		this.hoatDong = hoatDong;
 	}

	public int Add(String tenDonVi, String kyHieu, bool hoatDong)
	{
		try
		{
			int result = SqlHelper.ExecuteNonQuery(Common.Conn,"tblDonViTinh_Add",tenDonVi,kyHieu,hoatDong);
			return result;
		}
		catch(Exception e) {return -1; }
	}

	public int Update(int idDonVi, String tenDonVi, String kyHieu, bool hoatDong)
	{
		try
		{
			int result = SqlHelper.ExecuteNonQuery(Common.Conn,"tblDonViTinh_Update",idDonVi,tenDonVi,kyHieu,hoatDong);
			return result;
		}
		catch(Exception e) {return -1; }
	}

	public int Delete(int idDonVi)
	{
		try
		{
			int result = SqlHelper.ExecuteNonQuery(Common.Conn,"tblDonViTinh_Delete",idDonVi);
			return result;
		}
		catch(Exception e) {return -1; }
	}

	public int DeleteAll()
	{
		try
		{
			int result = SqlHelper.ExecuteNonQuery(Common.Conn,"tblDonViTinh_DeleteAll");
			return result;
		}
		catch(Exception e) {return -1; }
	}

	public DataSet Get(int idDonVi)
	{
		try
		{
			DataSet result = SqlHelper.ExecuteDataset(Common.Conn,"tblDonViTinh_Get",idDonVi);
			return result;
		}
		catch(Exception e) {return null; }
	}

	public DataSet GetAll()
	{
		try
		{
			DataSet result = SqlHelper.ExecuteDataset(Common.Conn,"tblDonViTinh_GetAll");
			return result;
		}
		catch(Exception e) {return null; }
	}

} 
}
